Skip to content

Add config.env sync tooling#4

Open
shabo wants to merge 1 commit into
mainfrom
chore/config-env-sync
Open

Add config.env sync tooling#4
shabo wants to merge 1 commit into
mainfrom
chore/config-env-sync

Conversation

@shabo

@shabo shabo commented Feb 13, 2026

Copy link
Copy Markdown
Owner

🎯 Problem

  • Keeping ~/.config/codeman/config.env aligned with the repo template was manual and error-prone (new keys get missed; old keys linger).

✅ Description

  • Add config/config.env.example as the canonical template for config.env.
  • Add scripts/sync_config_env.py to sync a local config file to the template while preserving user values and commented state.
  • Add Makefile targets (make config-sync, make config-sync-dry, make config-sync-diff).
  • Document the workflow in README.md and docs/README.md and reflect it on the GitHub Pages site.
  • Add a diagram of the sync flow under docs/diagrams/.
  • Ignore Python bytecode caches (__pycache__/, *.pyc).

🧭 Decision Notes

  • Chose a template-preserving sync (keeps ordering/comments) to avoid churn and keep the local file readable.
  • Default behavior is conservative: unknown local keys are kept unless explicitly deleted.
  • Diff output is opt-in and documented as potentially secret-bearing.

🗺️ Diagrams

  • docs/diagrams/config-env-sync.md (Mermaid flow of template → sync script → local config).

🧪 Validation

  • Manual: python3 scripts/sync_config_env.py --help
  • Manual: ./bin/codeman version

⚠️ Risk & Rollback

  • Risk: make config-sync-diff can print secrets (webhook URLs) to stdout.
  • Rollback: revert this PR; local user config remains unchanged unless make config-sync was run.

📈 Impact

  • Easier upgrades: users can pull updates and re-sync configs safely with less manual diffing.
  • Low operational risk; changes are additive and local-config tooling only.

🧠 Fun Fact 1

  • GitHub CLI (gh) can create PRs directly from the terminal and will infer repo context from the current git remote.

🔬 Fun Fact 2

  • The unified diff format traces back to early Unix tooling and remains a lingua franca for code review, patching, and reproducibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant